New get_volume_for_path() method. (struct _GtkFileSystemIface): Finally
authorFederico Mena Quintero <federico@ximian.com>
Fri, 16 Jan 2004 03:35:33 +0000 (03:35 +0000)
committerFederico Mena Quintero <federico@src.gnome.org>
Fri, 16 Jan 2004 03:35:33 +0000 (03:35 +0000)
2004-01-16  Federico Mena Quintero  <federico@ximian.com>

* gtk/gtkfilesystem.h (struct _GtkFileSystemIface): New
get_volume_for_path() method.
(struct _GtkFileSystemIface): Finally removed the list_roots() and
get_root_info() methods, and the "roots-changed" signal.

* gtk/gtkfilesystem.c (gtk_file_system_get_volume_for_path): New
function.
(gtk_file_system_list_roots): Removed.
(gtk_file_system_get_root_info): Removed.

* gtk/gtkfilesystemunix.c
(gtk_file_system_unix_get_volume_for_path): Implement.
(get_root_volume): New helper function.
(gtk_file_system_unix_list_volumes): Use get_root_volume().
(gtk_file_system_unix_list_roots): Removed.
(gtk_file_system_unix_get_root_info): Removed.

* gtk/gtkfilesystemmodel.c (_gtk_file_system_model_new): Don't
accept a NULL root_path.
(struct _GtkFileSystemModel): Add a field to remember the
root_path.
(_gtk_file_system_model_new): Store the root_path in the model
structure.
(find_and_ref_path): Stop going up the hierarchy at the root_path
of the model.  Also, don't return prematurely when walking up the
hierarchy.

* gtk/gtkfilechooserdefault.c (create_file_list): Sigh, restore
the rules_hint.
(struct _GtkFileChooserDefault): Added a current_volume_path field.
(set_tree_model): New function; create the folder tree model here.
(create_folder_tree): Don't create the model here.
(set_list_model): Set the show_hidden flag on the list model.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkfilechooserdefault.c
gtk/gtkfilesystem.c
gtk/gtkfilesystem.h
gtk/gtkfilesystemmodel.c
gtk/gtkfilesystemunix.c

index 5edefc4005dc8005fb52509ff6e2ba1165d0f7f0..c8a5a215558fd035132fda9bf03960b7d93c4e2b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,39 @@
+2004-01-16  Federico Mena Quintero  <federico@ximian.com>
+
+       * gtk/gtkfilesystem.h (struct _GtkFileSystemIface): New
+       get_volume_for_path() method.
+       (struct _GtkFileSystemIface): Finally removed the list_roots() and
+       get_root_info() methods, and the "roots-changed" signal.
+
+       * gtk/gtkfilesystem.c (gtk_file_system_get_volume_for_path): New
+       function.
+       (gtk_file_system_list_roots): Removed.
+       (gtk_file_system_get_root_info): Removed.
+
+       * gtk/gtkfilesystemunix.c
+       (gtk_file_system_unix_get_volume_for_path): Implement.
+       (get_root_volume): New helper function.
+       (gtk_file_system_unix_list_volumes): Use get_root_volume().
+       (gtk_file_system_unix_list_roots): Removed.
+       (gtk_file_system_unix_get_root_info): Removed.
+
+       * gtk/gtkfilesystemmodel.c (_gtk_file_system_model_new): Don't
+       accept a NULL root_path.
+       (struct _GtkFileSystemModel): Add a field to remember the
+       root_path.
+       (_gtk_file_system_model_new): Store the root_path in the model
+       structure.
+       (find_and_ref_path): Stop going up the hierarchy at the root_path
+       of the model.  Also, don't return prematurely when walking up the
+       hierarchy.
+
+       * gtk/gtkfilechooserdefault.c (create_file_list): Sigh, restore
+       the rules_hint.
+       (struct _GtkFileChooserDefault): Added a current_volume_path field.
+       (set_tree_model): New function; create the folder tree model here.
+       (create_folder_tree): Don't create the model here.
+       (set_list_model): Set the show_hidden flag on the list model.
+
 Fri Jan 16 00:04:43 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtknotebook.h:
index 5edefc4005dc8005fb52509ff6e2ba1165d0f7f0..c8a5a215558fd035132fda9bf03960b7d93c4e2b 100644 (file)
@@ -1,3 +1,39 @@
+2004-01-16  Federico Mena Quintero  <federico@ximian.com>
+
+       * gtk/gtkfilesystem.h (struct _GtkFileSystemIface): New
+       get_volume_for_path() method.
+       (struct _GtkFileSystemIface): Finally removed the list_roots() and
+       get_root_info() methods, and the "roots-changed" signal.
+
+       * gtk/gtkfilesystem.c (gtk_file_system_get_volume_for_path): New
+       function.
+       (gtk_file_system_list_roots): Removed.
+       (gtk_file_system_get_root_info): Removed.
+
+       * gtk/gtkfilesystemunix.c
+       (gtk_file_system_unix_get_volume_for_path): Implement.
+       (get_root_volume): New helper function.
+       (gtk_file_system_unix_list_volumes): Use get_root_volume().
+       (gtk_file_system_unix_list_roots): Removed.
+       (gtk_file_system_unix_get_root_info): Removed.
+
+       * gtk/gtkfilesystemmodel.c (_gtk_file_system_model_new): Don't
+       accept a NULL root_path.
+       (struct _GtkFileSystemModel): Add a field to remember the
+       root_path.
+       (_gtk_file_system_model_new): Store the root_path in the model
+       structure.
+       (find_and_ref_path): Stop going up the hierarchy at the root_path
+       of the model.  Also, don't return prematurely when walking up the
+       hierarchy.
+
+       * gtk/gtkfilechooserdefault.c (create_file_list): Sigh, restore
+       the rules_hint.
+       (struct _GtkFileChooserDefault): Added a current_volume_path field.
+       (set_tree_model): New function; create the folder tree model here.
+       (create_folder_tree): Don't create the model here.
+       (set_list_model): Set the show_hidden flag on the list model.
+
 Fri Jan 16 00:04:43 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtknotebook.h:
index 5edefc4005dc8005fb52509ff6e2ba1165d0f7f0..c8a5a215558fd035132fda9bf03960b7d93c4e2b 100644 (file)
@@ -1,3 +1,39 @@
+2004-01-16  Federico Mena Quintero  <federico@ximian.com>
+
+       * gtk/gtkfilesystem.h (struct _GtkFileSystemIface): New
+       get_volume_for_path() method.
+       (struct _GtkFileSystemIface): Finally removed the list_roots() and
+       get_root_info() methods, and the "roots-changed" signal.
+
+       * gtk/gtkfilesystem.c (gtk_file_system_get_volume_for_path): New
+       function.
+       (gtk_file_system_list_roots): Removed.
+       (gtk_file_system_get_root_info): Removed.
+
+       * gtk/gtkfilesystemunix.c
+       (gtk_file_system_unix_get_volume_for_path): Implement.
+       (get_root_volume): New helper function.
+       (gtk_file_system_unix_list_volumes): Use get_root_volume().
+       (gtk_file_system_unix_list_roots): Removed.
+       (gtk_file_system_unix_get_root_info): Removed.
+
+       * gtk/gtkfilesystemmodel.c (_gtk_file_system_model_new): Don't
+       accept a NULL root_path.
+       (struct _GtkFileSystemModel): Add a field to remember the
+       root_path.
+       (_gtk_file_system_model_new): Store the root_path in the model
+       structure.
+       (find_and_ref_path): Stop going up the hierarchy at the root_path
+       of the model.  Also, don't return prematurely when walking up the
+       hierarchy.
+
+       * gtk/gtkfilechooserdefault.c (create_file_list): Sigh, restore
+       the rules_hint.
+       (struct _GtkFileChooserDefault): Added a current_volume_path field.
+       (set_tree_model): New function; create the folder tree model here.
+       (create_folder_tree): Don't create the model here.
+       (set_list_model): Set the show_hidden flag on the list model.
+
 Fri Jan 16 00:04:43 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtknotebook.h:
index 5edefc4005dc8005fb52509ff6e2ba1165d0f7f0..c8a5a215558fd035132fda9bf03960b7d93c4e2b 100644 (file)
@@ -1,3 +1,39 @@
+2004-01-16  Federico Mena Quintero  <federico@ximian.com>
+
+       * gtk/gtkfilesystem.h (struct _GtkFileSystemIface): New
+       get_volume_for_path() method.
+       (struct _GtkFileSystemIface): Finally removed the list_roots() and
+       get_root_info() methods, and the "roots-changed" signal.
+
+       * gtk/gtkfilesystem.c (gtk_file_system_get_volume_for_path): New
+       function.
+       (gtk_file_system_list_roots): Removed.
+       (gtk_file_system_get_root_info): Removed.
+
+       * gtk/gtkfilesystemunix.c
+       (gtk_file_system_unix_get_volume_for_path): Implement.
+       (get_root_volume): New helper function.
+       (gtk_file_system_unix_list_volumes): Use get_root_volume().
+       (gtk_file_system_unix_list_roots): Removed.
+       (gtk_file_system_unix_get_root_info): Removed.
+
+       * gtk/gtkfilesystemmodel.c (_gtk_file_system_model_new): Don't
+       accept a NULL root_path.
+       (struct _GtkFileSystemModel): Add a field to remember the
+       root_path.
+       (_gtk_file_system_model_new): Store the root_path in the model
+       structure.
+       (find_and_ref_path): Stop going up the hierarchy at the root_path
+       of the model.  Also, don't return prematurely when walking up the
+       hierarchy.
+
+       * gtk/gtkfilechooserdefault.c (create_file_list): Sigh, restore
+       the rules_hint.
+       (struct _GtkFileChooserDefault): Added a current_volume_path field.
+       (set_tree_model): New function; create the folder tree model here.
+       (create_folder_tree): Don't create the model here.
+       (set_list_model): Set the show_hidden flag on the list model.
+
 Fri Jan 16 00:04:43 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtknotebook.h:
index 5edefc4005dc8005fb52509ff6e2ba1165d0f7f0..c8a5a215558fd035132fda9bf03960b7d93c4e2b 100644 (file)
@@ -1,3 +1,39 @@
+2004-01-16  Federico Mena Quintero  <federico@ximian.com>
+
+       * gtk/gtkfilesystem.h (struct _GtkFileSystemIface): New
+       get_volume_for_path() method.
+       (struct _GtkFileSystemIface): Finally removed the list_roots() and
+       get_root_info() methods, and the "roots-changed" signal.
+
+       * gtk/gtkfilesystem.c (gtk_file_system_get_volume_for_path): New
+       function.
+       (gtk_file_system_list_roots): Removed.
+       (gtk_file_system_get_root_info): Removed.
+
+       * gtk/gtkfilesystemunix.c
+       (gtk_file_system_unix_get_volume_for_path): Implement.
+       (get_root_volume): New helper function.
+       (gtk_file_system_unix_list_volumes): Use get_root_volume().
+       (gtk_file_system_unix_list_roots): Removed.
+       (gtk_file_system_unix_get_root_info): Removed.
+
+       * gtk/gtkfilesystemmodel.c (_gtk_file_system_model_new): Don't
+       accept a NULL root_path.
+       (struct _GtkFileSystemModel): Add a field to remember the
+       root_path.
+       (_gtk_file_system_model_new): Store the root_path in the model
+       structure.
+       (find_and_ref_path): Stop going up the hierarchy at the root_path
+       of the model.  Also, don't return prematurely when walking up the
+       hierarchy.
+
+       * gtk/gtkfilechooserdefault.c (create_file_list): Sigh, restore
+       the rules_hint.
+       (struct _GtkFileChooserDefault): Added a current_volume_path field.
+       (set_tree_model): New function; create the folder tree model here.
+       (create_folder_tree): Don't create the model here.
+       (set_list_model): Set the show_hidden flag on the list model.
+
 Fri Jan 16 00:04:43 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtknotebook.h:
index 9a36b6e6c6bb74bb6748076b5a6a03a06b525696..0f5eaedf7c0ee124bb194cd873b62659c9db3f0f 100644 (file)
@@ -93,6 +93,7 @@ struct _GtkFileChooserDefault
 
   guint bookmarks_changed_id;
 
+  GtkFilePath *current_volume_path;
   GtkFilePath *current_folder;
   GtkFilePath *preview_path;
 
@@ -787,7 +788,6 @@ static void
 shortcuts_append_bookmarks (GtkFileChooserDefault *impl)
 {
   GtkTreeIter iter;
-  GSList *bookmarks;
 
   gtk_tree_store_append (impl->shortcuts_model, &iter, NULL);
   gtk_tree_store_set (impl->shortcuts_model, &iter,
@@ -982,15 +982,6 @@ create_folder_tree (GtkFileChooserDefault *impl)
   gtk_container_add (GTK_CONTAINER (impl->tree_scrollwin), impl->tree);
   gtk_widget_show (impl->tree);
 
-  /* Model */
-
-  impl->tree_model = _gtk_file_system_model_new (impl->file_system, NULL, -1,
-                                                GTK_FILE_INFO_DISPLAY_NAME);
-  _gtk_file_system_model_set_show_files (impl->tree_model, FALSE);
-
-  gtk_tree_view_set_model (GTK_TREE_VIEW (impl->tree),
-                          GTK_TREE_MODEL (impl->tree_model));
-
   /* Column */
 
   gtk_tree_view_insert_column_with_data_func (GTK_TREE_VIEW (impl->tree), 0,
@@ -1336,6 +1327,7 @@ create_file_list (GtkFileChooserDefault *impl)
   /* Tree/list view */
 
   impl->list = gtk_tree_view_new ();
+  gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (impl->list), TRUE);
   gtk_container_add (GTK_CONTAINER (impl->list_scrollwin), impl->list);
   g_signal_connect (impl->list, "row_activated",
                    G_CALLBACK (list_row_activated), impl);
@@ -1878,6 +1870,7 @@ set_list_model (GtkFileChooserDefault *impl)
                                                 GTK_FILE_INFO_IS_FOLDER |
                                                 GTK_FILE_INFO_SIZE |
                                                 GTK_FILE_INFO_MODIFICATION_TIME);
+  _gtk_file_system_model_set_show_hidden (impl->list_model, impl->show_hidden);
   install_list_model_filter (impl);
 
   impl->sort_model = (GtkTreeModelSort *)gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (impl->list_model));
@@ -1898,6 +1891,40 @@ set_list_model (GtkFileChooserDefault *impl)
                                   GTK_FILE_SYSTEM_MODEL_DISPLAY_NAME);
 }
 
+/* Gets rid of the old folder tree model and creates a new one for the volume
+ * corresponding to the specified path.
+ */
+static void
+set_tree_model (GtkFileChooserDefault *impl, const GtkFilePath *path)
+{
+  GtkFileSystemVolume *volume;
+  GtkFilePath *volume_path;
+
+  volume = gtk_file_system_get_volume_for_path (impl->file_system, path);
+  volume_path = gtk_file_system_volume_get_base_path (impl->file_system, volume);
+
+  if (impl->current_volume_path && gtk_file_path_compare (volume_path, impl->current_volume_path) == 0)
+    goto out;
+
+  if (impl->tree_model)
+    g_object_unref (impl->tree_model);
+
+  impl->current_volume_path = gtk_file_path_copy (volume_path);
+
+  impl->tree_model = _gtk_file_system_model_new (impl->file_system, impl->current_volume_path, -1,
+                                                GTK_FILE_INFO_DISPLAY_NAME);
+  _gtk_file_system_model_set_show_files (impl->tree_model, FALSE);
+  _gtk_file_system_model_set_show_hidden (impl->tree_model, impl->show_hidden);
+
+  gtk_tree_view_set_model (GTK_TREE_VIEW (impl->tree),
+                          GTK_TREE_MODEL (impl->tree_model));
+
+ out:
+
+  gtk_file_path_free (volume_path);
+  gtk_file_system_volume_free (impl->file_system, volume);
+}
+
 static void
 update_chooser_entry (GtkFileChooserDefault *impl)
 {
@@ -1943,11 +1970,12 @@ gtk_file_chooser_default_set_current_folder (GtkFileChooser    *chooser,
   gtk_label_set_text (GTK_LABEL (impl->folder_label), str);
   g_free (str);
 
-  /* Notify the folder tree */
+  /* Update the folder tree */
 
   if (!impl->changing_folder)
     {
       impl->changing_folder = TRUE;
+      set_tree_model (impl, impl->current_folder);
       _gtk_file_system_model_path_do (impl->tree_model, path,
                                      expand_and_select_func, impl);
       impl->changing_folder = FALSE;
index 691941b42a94a5f57bb67cf7b7c0a9acd26279cc..0a7d476751e36faf317b3da51c136317a0da1660 100644 (file)
@@ -454,13 +454,6 @@ gtk_file_system_base_init (gpointer g_class)
                    NULL, NULL,
                    g_cclosure_marshal_VOID__VOID,
                    G_TYPE_NONE, 0);
-      g_signal_new ("roots-changed",
-                   iface_type,
-                   G_SIGNAL_RUN_LAST,
-                   G_STRUCT_OFFSET (GtkFileSystemIface, roots_changed),
-                   NULL, NULL,
-                   g_cclosure_marshal_VOID__VOID,
-                   G_TYPE_NONE, 0);
       g_signal_new ("bookmarks-changed",
                    iface_type,
                    G_SIGNAL_RUN_LAST,
@@ -481,27 +474,6 @@ gtk_file_system_list_volumes (GtkFileSystem  *file_system)
   return GTK_FILE_SYSTEM_GET_IFACE (file_system)->list_volumes (file_system);
 }
 
-GSList *
-gtk_file_system_list_roots (GtkFileSystem  *file_system)
-{
-  g_return_val_if_fail (GTK_IS_FILE_SYSTEM (file_system), NULL);
-
-  return GTK_FILE_SYSTEM_GET_IFACE (file_system)->list_roots (file_system);
-}
-
-GtkFileInfo *
-gtk_file_system_get_root_info  (GtkFileSystem     *file_system,
-                               const GtkFilePath *path,
-                               GtkFileInfoType    types,
-                               GError           **error)
-{
-  g_return_val_if_fail (GTK_IS_FILE_SYSTEM (file_system), NULL);
-  g_return_val_if_fail (path != NULL, NULL);
-  g_return_val_if_fail (error == NULL || *error == NULL, NULL);
-
-  return GTK_FILE_SYSTEM_GET_IFACE (file_system)->get_root_info (file_system, path, types, error);
-}
-
 GtkFileFolder *
 gtk_file_system_get_folder (GtkFileSystem     *file_system,
                            const GtkFilePath *path,
@@ -527,6 +499,26 @@ gtk_file_system_create_folder(GtkFileSystem     *file_system,
   return GTK_FILE_SYSTEM_GET_IFACE (file_system)->create_folder (file_system, path, error);
 }
 
+/**
+ * gtk_file_system_get_volume_for_path:
+ * @file_system: a #GtkFileSystem
+ * @path: a #GtkFilePath
+ * 
+ * Queries the file system volume that corresponds to a specific path.
+ * 
+ * Return value: the #GtkFileSystemVolume that corresponds to the specified
+ * @path.  You should free this value with gtk_file_system_volume_free().
+ **/
+GtkFileSystemVolume *
+gtk_file_system_get_volume_for_path (GtkFileSystem     *file_system,
+                                    const GtkFilePath *path)
+{
+  g_return_val_if_fail (GTK_IS_FILE_SYSTEM (file_system), NULL);
+  g_return_val_if_fail (path != NULL, NULL);
+
+  return GTK_FILE_SYSTEM_GET_IFACE (file_system)->get_volume_for_path (file_system, path);
+}
+
 /**
  * gtk_file_system_volume_free:
  * @file_system: a #GtkFileSystem
@@ -1016,7 +1008,7 @@ gtk_file_paths_sort (GSList *paths)
 
 /**
  * gtk_file_paths_copy:
- * @paths: A #GSList of 3GtkFilePath structures.
+ * @paths: A #GSList of #GtkFilePath structures.
  * 
  * Copies a list of #GtkFilePath structures.
  * 
index 394938864533f26b11052c521cbe96c1c67ada5c..9f9d2650c01b7daceeaa2dcaf11961f33b316bad 100644 (file)
@@ -144,13 +144,9 @@ struct _GtkFileSystemIface
 
   /* Methods
    */
-  GSList *           (*list_volumes)   (GtkFileSystem     *file_system);
-  GSList *           (*list_roots)     (GtkFileSystem     *file_system);
-
-  GtkFileInfo *      (*get_root_info)  (GtkFileSystem     *file_system,
-                                       const GtkFilePath *path,
-                                       GtkFileInfoType    types,
-                                       GError           **error);
+  GSList *              (*list_volumes)        (GtkFileSystem     *file_system);
+  GtkFileSystemVolume * (*get_volume_for_path) (GtkFileSystem     *file_system,
+                                               const GtkFilePath *path);
 
   GtkFileFolder *    (*get_folder)     (GtkFileSystem     *file_system,
                                        const GtkFilePath *path,
@@ -226,18 +222,15 @@ struct _GtkFileSystemIface
   /* Signals
    */
   void (*volumes_changed)   (GtkFileSystem *file_system);
-  void (*roots_changed)     (GtkFileSystem *file_system);
   void (*bookmarks_changed) (GtkFileSystem *file_system);
 };
 
 GType             gtk_file_system_get_type       (void);
 
 GSList *          gtk_file_system_list_volumes   (GtkFileSystem     *file_system);
-GSList *          gtk_file_system_list_roots     (GtkFileSystem     *file_system);
-GtkFileInfo *     gtk_file_system_get_root_info  (GtkFileSystem     *file_system,
-                                                 const GtkFilePath *path,
-                                                 GtkFileInfoType    types,
-                                                 GError           **error);
+
+GtkFileSystemVolume *gtk_file_system_get_volume_for_path (GtkFileSystem     *file_system,
+                                                         const GtkFilePath *path);
 
 void              gtk_file_system_volume_free             (GtkFileSystem        *file_system,
                                                           GtkFileSystemVolume  *volume);
index 184f9d43780a84d08110762bd68227f607fb89e6..66aec6eaf527f4882ecaa782a8ca52e20e65e3e2 100644 (file)
@@ -45,6 +45,7 @@ struct _GtkFileSystemModel
   GtkFileInfoType types;
   FileModelNode  *roots;
   GtkFileFolder  *root_folder;
+  GtkFilePath    *root_path;
 
   GtkFileSystemModelFilter filter_func;
   gpointer filter_data;
@@ -143,8 +144,10 @@ static void               file_model_node_clear        (GtkFileSystemModel *mode
 static FileModelNode *    file_model_node_get_children (GtkFileSystemModel *model,
                                                        FileModelNode      *node);
 
+#if 0
 static void roots_changed_callback (GtkFileSystem      *file_system,
                                    GtkFileSystemModel *model);
+#endif
                                    
 static void deleted_callback       (GtkFileFolder *folder,
                                    FileModelNode *node);
@@ -539,9 +542,7 @@ gtk_file_system_model_unref_node (GtkTreeModel *tree_model,
 /**
  * _gtk_file_system_model_new:
  * @file_system: an object implementing #GtkFileSystem
- * @root_path: the path of root of the file system to display,
- *            or %NULL to display starting from the
- *            root or roots of the fielsystem.
+ * @root_path: the path of root of the file system to display
  * @max_depth: the maximum depth from the children of @root_path
  *             or the roots of the file system to display in
  *             the file selector). A depth of 0 displays
@@ -571,6 +572,7 @@ _gtk_file_system_model_new (GtkFileSystem     *file_system,
   GSList *tmp_list;
 
   g_return_val_if_fail (GTK_IS_FILE_SYSTEM (file_system), NULL);
+  g_return_val_if_fail (root_path != NULL, NULL);
 
   model = g_object_new (GTK_TYPE_FILE_SYSTEM_MODEL, NULL);
   model->file_system = g_object_ref (file_system);
@@ -583,7 +585,8 @@ _gtk_file_system_model_new (GtkFileSystem     *file_system,
   if (root_path)
     {
       GSList *child_paths;
-      
+
+      model->root_path = gtk_file_path_copy (root_path);
       model->root_folder = gtk_file_system_get_folder (file_system, root_path,
                                                       model->types,
                                                       NULL);   /* NULL-GError */
@@ -605,12 +608,14 @@ _gtk_file_system_model_new (GtkFileSystem     *file_system,
                                   G_CALLBACK (root_files_removed_callback), model, 0);
        }
     }
+#if 0
   else
     {
       roots = gtk_file_system_list_roots (file_system);
       g_signal_connect_object (file_system, "roots-changed",
                               G_CALLBACK (roots_changed_callback), model, 0);
     }
+#endif
 
   roots = gtk_file_paths_sort (roots);
   
@@ -859,16 +864,14 @@ find_and_ref_path (GtkFileSystemModel  *model,
   FileModelNode *child_node;
   GtkFileFolder *folder;
 
-  if (!gtk_file_system_get_parent (model->file_system, path, &parent_path, NULL))
+  if (gtk_file_path_compare (path, model->root_path) == 0
+      || !gtk_file_system_get_parent (model->file_system, path, &parent_path, NULL))
     return NULL;
 
   if (parent_path)
     {
       parent_node = find_and_ref_path (model, parent_path, cleanups);
       gtk_file_path_free (parent_path);
-
-      if (!parent_node)
-       return NULL;
     }
   else
     parent_node = NULL;
@@ -1023,6 +1026,7 @@ file_model_node_get_info (GtkFileSystemModel *model,
                                                 node->path,
                                                 NULL); /* NULL-GError */
        }
+#if 0
       else
        {
          node->info = gtk_file_system_get_root_info (model->file_system,
@@ -1030,6 +1034,7 @@ file_model_node_get_info (GtkFileSystemModel *model,
                                                      model->types,
                                                      NULL);  /* NULL-GError */
        }
+#endif
     }
 
   return node->info;
@@ -1557,6 +1562,7 @@ do_files_removed (GtkFileSystemModel *model,
   g_slist_free (sorted_paths);
 }
 
+#if 0
 static void
 roots_changed_callback (GtkFileSystem      *file_system,
                        GtkFileSystemModel *model)
@@ -1653,6 +1659,7 @@ roots_changed_callback (GtkFileSystem      *file_system,
   g_slist_free (new_roots);
   gtk_tree_path_free (path);
 }
+#endif
 
 static void
 deleted_callback (GtkFileFolder      *folder,
index fa232977ebdee1f5fdc6e60159bbe47690bfe6fe..c808b816c0a635ae614a5a771184c8dc19e7e0d5 100644 (file)
@@ -83,12 +83,10 @@ static void gtk_file_system_unix_iface_init   (GtkFileSystemIface     *iface);
 static void gtk_file_system_unix_init         (GtkFileSystemUnix      *impl);
 static void gtk_file_system_unix_finalize     (GObject                *object);
 
-static GSList *       gtk_file_system_unix_list_volumes  (GtkFileSystem      *file_system);
-static GSList *       gtk_file_system_unix_list_roots    (GtkFileSystem      *file_system);
-static GtkFileInfo *  gtk_file_system_unix_get_root_info (GtkFileSystem      *file_system,
-                                                         const GtkFilePath  *path,
-                                                         GtkFileInfoType     types,
-                                                         GError            **error);
+static GSList *             gtk_file_system_unix_list_volumes        (GtkFileSystem     *file_system);
+static GtkFileSystemVolume *gtk_file_system_unix_get_volume_for_path (GtkFileSystem     *file_system,
+                                                                     const GtkFilePath *path);
+
 static GtkFileFolder *gtk_file_system_unix_get_folder    (GtkFileSystem      *file_system,
                                                          const GtkFilePath  *path,
                                                          GtkFileInfoType     types,
@@ -243,9 +241,8 @@ static void
 gtk_file_system_unix_iface_init   (GtkFileSystemIface *iface)
 {
   iface->list_volumes = gtk_file_system_unix_list_volumes;
-  iface->list_roots = gtk_file_system_unix_list_roots;
+  iface->get_volume_for_path = gtk_file_system_unix_get_volume_for_path;
   iface->get_folder = gtk_file_system_unix_get_folder;
-  iface->get_root_info = gtk_file_system_unix_get_root_info;
   iface->create_folder = gtk_file_system_unix_create_folder;
   iface->volume_free = gtk_file_system_unix_volume_free;
   iface->volume_get_base_path = gtk_file_system_unix_volume_get_base_path;
@@ -277,29 +274,24 @@ gtk_file_system_unix_finalize (GObject *object)
   system_parent_class->finalize (object);
 }
 
-static GSList *
-gtk_file_system_unix_list_volumes (GtkFileSystem *file_system)
+/* Returns our single root volume */
+static GtkFileSystemVolume *
+get_root_volume (void)
 {
-  return g_slist_append (NULL, gtk_file_path_new_dup ("/"));
+  return (GtkFileSystemVolume *) gtk_file_path_new_dup ("/");
 }
 
 static GSList *
-gtk_file_system_unix_list_roots (GtkFileSystem *file_system)
+gtk_file_system_unix_list_volumes (GtkFileSystem *file_system)
 {
-  return g_slist_append (NULL, gtk_file_path_new_dup ("/"));
+  return g_slist_append (NULL, get_root_volume ());
 }
 
-static GtkFileInfo *
-gtk_file_system_unix_get_root_info (GtkFileSystem    *file_system,
-                                   const GtkFilePath      *path,
-                                   GtkFileInfoType   types,
-                                   GError          **error)
+static GtkFileSystemVolume *
+gtk_file_system_unix_get_volume_for_path (GtkFileSystem     *file_system,
+                                         const GtkFilePath *path)
 {
-  const gchar *filename = gtk_file_path_get_string (path);
-
-  g_return_val_if_fail (strcmp (filename, "/") == 0, NULL);
-
-  return filename_get_info ("/", types, error);
+  return get_root_volume ();
 }
 
 static GtkFileFolder *